package com.zqxq.lottery.api.controller;


import com.zqxq.common.constant.Result;
import com.zqxq.lottery.api.feign.LotteryServerFeignClient;
import com.zqxq.lottery.entity.bo.sys.LotteryHnumBO;
import com.zqxq.lottery.entity.bo.sys.LotteryKindBO;
import com.zqxq.lottery.entity.vo.sys.LotteryHnumVO;
import com.zqxq.lottery.entity.vo.sys.LotteryKindVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 说    明：   竞猜 接口
 * 创 建 人：	一刀·胡
 * 创建时间：	2018/3/22 17:56
 * 修 改 人：
 * 修改日期：
 **/
@Api(value = "竞猜接口",tags = "竞猜接口")
@Slf4j
@RestController
@RequestMapping(value="/lottery",produces = "application/json")
public class LotteryController {

    @Autowired
    private LotteryServerFeignClient lotteryServerFeignClient;

    @PostMapping("/kind/list")
    @ApiOperation(value = "热门竞猜", notes = "热门竞猜")
    public Result<List<LotteryKindVO>> queryLotteryKindList(LotteryKindBO search){
        return lotteryServerFeignClient.queryLotteryKindList(search);
    }

    @PostMapping("/hnum/page")
    @ApiOperation(value = "历史开奖", notes = "历史开奖")
    public Result<List<LotteryHnumVO>> queryLotteryHnumPage(LotteryHnumBO search){
        search.setStatus(3);
        return lotteryServerFeignClient.queryLotteryHnumPage(search);
    }

    @PostMapping("/hnum/get")
    @ApiOperation(value = "历史开奖详情", notes = "历史开奖详情")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "开奖ID", required = true,dataType = "Long", paramType = "query"),
    })
    public Result<LotteryHnumVO> getLotteryHnum(Long id){
        return lotteryServerFeignClient.getLotteryHnum(id);
    }

    @PostMapping("/hnum/last")
    @ApiOperation(value = "获取各彩种最后一期开奖结果信息", notes = "获取各彩种最后一期开奖结果信息")
    public Result<LotteryHnumVO> queryLastOpenList(){
        return lotteryServerFeignClient.queryLastOpenList();
    }

}
